//
//
//
//
//
// SocketHandle.C

#include "SocketHandle.h"
#include "LogManager.h"
#include "Exception.h"

SocketHandle::SocketHandle(){};

SocketHandle::~SocketHandle(){};


// return 0 to indicate client closed socket
// throw exception when error
// return > 0 to indicate bytes reads
int SocketHandle::HandleInput(TCPSocket& sock)
{	
	LOGTRACE("SocketHandle::HandleInput");
	S32 ret = 0;
	try
	{	
		char szBuf[128];
		ret = sock.Read(szBuf, sizeof(szBuf) - 1);
		szBuf[ret] = '\0';
		LOGTRACE(szBuf);
	}
	catch(const Exception& exp)
	{
		LOGERROR(exp.What());
	}
	return ret;
}

int SocketHandle::HandleOutput(TCPSocket& sock)
{
	LOGTRACE("SocketHandle::HandleOutput");
	return 0;
}

int SocketHandle::HandleException(TCPSocket& sock)
{
	LOGTRACE("SocketHandle::HandleException");
	return 0;
}

int SocketHandle::HandleTimeout(TCPSocket& sock)
{
	LOGTRACE("SocketHandle::HandleTimeout");
	return 0;
}
